<template>
  <div>
      <h2>{{msg}}</h2>
  </div>
</template>

<script>

// mounted 钩子函数  这里去请求豆瓣数据

export default {
  name: 'home',
  data () {
    return {
      msg: '电影列表',
      articles:[]
    }
  },
  created:function(){  //这里mounted和created生命周期函数区别
     this.$http.jsonp('https://api.douban.com/v2/movie/top250?count=10', {}, {
        headers: {

        },
        emulateJSON: true
    }).then(function(response) {
      // 这里是处理正确的回调
        console.log(response);
        this.articles = response.data.subjects
        // this.articles = response.data["subjects"] 也可以

    }, function(response) {
        // 这里是处理错误的回调
        console.log(response)
    });
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
ul{
  list-style: none;
  margin: 0;
  padding: 0;
}
ul li{
border-bottom: 1px solid #999;
padding: 10px 0;
}

.inl-block{
display: inline-block;
}

</style>
